import { Injectable } from '@angular/core';
import { RequestService } from '../../../cores/services/request.service';
import { ApiData } from '../../../cores/classes/api-data.class';
import { SearchParams } from '../../../cores/classes/search-params';
import { Recharge } from '../interfaces/recharge.interfaces';
import { Observable } from 'rxjs';
import { Pagination } from 'ng-tui';
import { map } from 'rxjs/operators';


@Injectable()
export class JoblService {

    constructor(private request: RequestService) { }

    /**
     * 职位列表
     */
    searchCrash(pagination: Pagination, search: SearchParams): Observable<ApiData> {
        return this.request.get('/managerapi/position/list', pagination.getpageDataWith(search.values));
    }
    /**
     * 删除职位列表
     */
    del(id: number): Observable<ApiData> {
        return this.request.delete('/managerapi/position/delete', { id });
    }

    /**
   * 添加列表
   * @param {Banner} banner 添加数据
   */
    insertBanner(banner: Recharge): Observable<ApiData> {
        return this.request.post('/managerapi/position/add', banner);
    }


    /**
   * 编辑
   * @param {Banner} banner 编辑
   */
    updateBanner(banner: Recharge): Observable<ApiData> {
        return this.request.put('/managerapi/position/update', banner);
    }

    /**
   * 获取部门列表
   * @param ids 部门列表
   */
    getseller(pagination: Pagination, search: SearchParams): Observable<ApiData> {
        return this.request.get('/managerapi/department/list', pagination.getpageDataWith(search.values));
    }
    /**
        * 获取公司列表
        * @param ids 公司列表
        */
    company(): Observable<ApiData> {
        return this.request.url('/managerapi/company/list', );
    }

    /**
   * 通过公司获取部门列表
   */
    departmentList(companyId: number): Observable<ApiData> {
        // console.log(search)
        return this.request.get('/managerapi/department/get', { companyId });
    }
    // /**
    //  * 通过公司获取部门列表
    //  */
    // joblist(pagination: Pagination, search: SearchParams): Observable<ApiData> {
    //     return this.request.get('/managerapi/department/get', pagination.getpageDataWith(search.values));
    // }
    /**
     * 通过公司获取部门列表
     */
    joblist(pagination: Pagination, search: SearchParams): Observable<ApiData> {
        return this.request.get('/managerapi/department/get', pagination.getpageDataWith(search.values));
    }
    /**
     * 通过公司获取部门列表
     */
    joblists(): Observable<ApiData> {
        return this.request.url('/managerapi/department/get');
    }
    /**
  /**
* 获取权限列表 ,
* @param ids 权限列表
*/
    permission(): Observable<ApiData> {
        return this.request.url('/managerapi/role/permission/get', );
    }
}
